﻿using System;
using System.Configuration;

namespace LaoLuo.Configuration
{
    public class TimeSpanElement : ConfigurationElement
    {
        public TimeSpan TimeSpanValue
        {
            get
            {
                return new TimeSpan(Days, Hours, Minutes, Seconds, 0);
            }
        }

        [ConfigurationProperty("days")]
        public Int32 Days
        {
            get
            {
                return (Int32)this["days"];
            }
        }

        [ConfigurationProperty("hours")]
        public Int32 Hours
        {
            get
            {
                return (Int32)this["hours"];
            }
        }

        [ConfigurationProperty("minutes")]
        public Int32 Minutes
        {
            get
            {
                return (Int32)this["minutes"];
            }
        }

        [ConfigurationProperty("seconds")]
        public Int32 Seconds
        {
            get
            {
                return (Int32)this["seconds"];
            }
        }
    }
}
